{include file='pub/header'/}
<title>跟单分类</title>
</head>
<body>
<nav class="breadcrumb">
    {$breadNav}
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" onclick="category_add('添加分类','{:url(\'FollowOrder/addFollowCate\')}')"
               href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加分类</a>
        </span>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th width="40">ID</th>
                <th width="100">分类名称</th>
                <th width="100">添加时间</th>
                <th width="100">更新时间</th>
                <th width="150">操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $cateList as $list}
            <tr class="text-c">
                <td>{$list.id}</td>
                <td class="text-l">{$list.name}</td>
                <td class="text-l">{:date('Y-m-d H:i',$list.create_time)}</td>
                <td class="text-l">{:date('Y-m-d H:i',$list.update_time)}</td>
                <td class="td-manage">
                    <a style="text-decoration:none" class="ml-5"
                       onClick="category_edit('分类编辑','{:url(\'FollowOrder/addFollowCate\', [\'id\'=>$list.id])}')"
                       href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i>编辑</a>
                    <a style="text-decoration:none" class="ml-5" onClick="category_del(this,'{$list.id}')"
                       href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i>删除</a>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>

{include file="pub/footer"/}
<script type="text/javascript">

    /*分类-添加*/
    function category_add(title, url) {
        var index = layer.open({
            type: 2,
            title: title,
            area: ['600px', '450px'],
            content: url
        });
    }


    /*分类-编辑*/
    function category_edit(title, url, id) {
        // console.log(url);
        // return;
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
            area: ['600px', '450px']
        });
        // layer.full(index);
    }

    /*分类-删除*/
    function category_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: '{:url("FollowOrder/delFollowCate")}',
                data: {ids: id},
                dataType: 'json',
                success: function (data) {
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!', {icon: 1, time: 1000});
                },
                error: function (data) {
                    console.log(data.msg);
                },
            });
        });
    }
</script>
</body>
</html>